package com.jason.demo.servicehi.concurrent.con1;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;

/**
 * @author zhouxinghuai
 * @description description
 * @date 2018-09-10
 */
public class ConditionSignalDemo implements Runnable {

    private Lock lock;
    private Condition condition;

    public ConditionSignalDemo(Lock lock, Condition condition) {
        this.lock = lock;
        this.condition = condition;
    }

    @Override
    public void run() {
        System.out.println("begin -ConditionSignalDemo");
        try {
            lock.lock();
            condition.signal();
            System.out.println("end - ConditionSignalDemo");
        } finally {
            lock.unlock();
        }

    }
}
